from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token
from meiduo_admin.views import images

from meiduo_admin.views import statistical
from meiduo_admin.views import users
from rest_framework.routers import DefaultRouter
from .views import statistical,users,specs,skus,orders,permissions,groups,admin,spus

urlpatterns = [
    #登陆
    url(r'^authorizations/$',obtain_jwt_token),
    url(r'^statistical/total_count/$',statistical.UserCountView.as_view()),
    url(r'^statistical/day_increment/$',statistical.UserDayCountView.as_view()),
    url(r'^statistical/day_active/$',statistical.UserDayActiveCountView.as_view()),
    url(r'^statistical/day_orders/$',statistical.UserDayOrderView.as_view()),
    url(r'^statistical/month_increment/$',statistical.UserMouthOrderView.as_view()),
    url(r'^statistical/goods_day_views/$',statistical.UserGoodsCountView.as_view()),
#--------------------用户管理路由
    url(r'^users/$', users.UserView.as_view()),
    url(r'^goods/simple/$', specs.SpecsView.as_view({'get':'simple'})),
    #图片路由
    url(r'^skus/simple/$',images.ImagesView.as_view({'get':'simple'})),
    #ｓｋｕ路由
    url(r'^goods/(?P<pk>\d+)/specs/$', skus.SKUView.as_view({'get': 'specs'})),
    #权限路由
    url(r'^permission/content_types/$', permissions.PermissionsView.as_view({'get': 'content_type'})),
    #分组陆路由
    url(r'^permission/simple/$',groups.GroupView.as_view({'get': 'simple'})),
    # 新增
    url(r'^permission/groups/simple/$', admin.AdminView.as_view({'get': 'simple'})),
    # 新增spu
    url(r'^goods/brands/simple/$', spus.SPUView.as_view({'get': 'simple'})),
    url(r'^goods/channel/categories/$', spus.SPUView.as_view({'get': 'channel'})),
    url(r'^goods/channel/categories/(?P<pk>\d+)/$', spus.SPUView.as_view({'get': 'channels'})),
    url(r'^goods/images/$', spus.SPUView.as_view({'post': 'image'})),

]
# -------------------规格表路由
router = DefaultRouter()
router.register('goods/specs',specs.SpecsView,base_name='specs')
print(router.urls)
urlpatterns += router.urls
#------------图片表路由
router = DefaultRouter()
router.register('skus/images', images.ImagesView, base_name='images')
print(router.urls)
urlpatterns += router.urls
# sku路由
router = DefaultRouter()
router.register('skus', skus.SKUView, base_name='skus')
print(router.urls)
urlpatterns += router.urls

# spu路由
router = DefaultRouter()
router.register('goods', spus.SPUView, base_name='spus')

urlpatterns += router.urls






#订单路由

router = DefaultRouter()
router.register('orders', orders.OrderView, base_name='orders')
# print(router.urls)
urlpatterns += router.urls

#权限路由

router = DefaultRouter()
router.register('permission/perms',permissions.PermissionsView,base_name='perms')
urlpatterns += router.urls

#分组路由

router = DefaultRouter()
router.register('permission/groups',groups.GroupView,base_name='groups')
urlpatterns += router.urls

#admin路由
router = DefaultRouter()
router.register('permission/admins',admin.AdminView,base_name='admin')
urlpatterns += router.urls
